<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta
            name="viewport"
            content="initial-scale=1.0, user-scalable=no, width=device-width"
    />
    <title>HELLO，AMAP!</title>
    <style>
        html,
        body,
        #container {
          width: 100%;
          height: 100%;
        }
    </style>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script type="text/javascript">
    window._AMapSecurityConfig = {
      securityJsCode: "68028d10001a544a3953370193852d04",
    };
</script>
<script
        type="text/javascript"
        src="https://webapi.amap.com/maps?v=2.0&key=16380b06b3a6b21f09c141f3ff0a27f9"
></script>
<script type="text/javascript">
    //地图初始化应该在地图容器 <div> 已经添加到 DOM 树之后
    var map = new AMap.Map("container", {
      zoom: 16,
      center:[118.779105,31.991412]
    });


    function getLocalPosition(lng,lat){
       map.setZoomAndCenter(30, [lng, lat])
       const marker = new AMap.Marker({
       position: [lng,lat],
       icon: 'https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
       map:map
       });
       map.add(marker);

       AMap.plugin(["AMap.PlaceSearch"], function() {
        //构造地点查询类
        var placeSearch = new AMap.PlaceSearch({
            pageSize: 5, // 单页显示结果条数
            pageIndex: 1, // 页码
            map: map, // 展现结果的地图实例
            autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
        });

        var cpoint = [lng,lat]; //中心点坐标
        placeSearch.searchNearBy("咖啡厅", cpoint, 200, function(status, result) {
        window.swift.receiveHtmlData(JSON.stringify(result.poiList.pois))
        });
    });
    }
<!--    window.onload=function(){-->
<!--        getLocalPosition(113.341107,23.136608)-->
<!--    }-->

</script>